/**
 * 
 */
package com.mywind.entity.core;

import java.io.Serializable;

/**
 * @author A01162
 * 
 */
public class JqGridQueryEntity implements Serializable {
	private static final long serialVersionUID = -2849625318773684220L;

	/** 当前页面 */
	private int page;
	/** 每页的记录数 */
	private int rows;
	/** 查询字段值 */
	private boolean search;
	private String searchField;
	private String searchOper;
	private String searchString;

	/** 排序字段和排序方式如：username/asc */
	private String sidx;
	private String sord;

	/** 分页信息:总记录数 */
	private int totalCount;
	private int totalPage; // 总页数

	private int currentResult; // 当前记录起始索引

	/**
	 * @return the page
	 */
	public int getPage() {
		return page;
	}

	/**
	 * @param page
	 *            the page to set
	 */
	public void setPage(int page) {
		this.page = page;
	}

	/**
	 * @return the rows
	 */
	public int getRows() {
		return rows;
	}

	/**
	 * @param rows
	 *            the rows to set
	 */
	public void setRows(int rows) {
		this.rows = rows;
	}

	/**
	 * @return the search
	 */
	public boolean isSearch() {
		return search;
	}

	/**
	 * @param search
	 *            the search to set
	 */
	public void setSearch(boolean search) {
		this.search = search;
	}

	/**
	 * @return the searchField
	 */
	public String getSearchField() {
		return searchField;
	}

	/**
	 * @param searchField
	 *            the searchField to set
	 */
	public void setSearchField(String searchField) {
		this.searchField = searchField;
	}

	/**
	 * @return the searchOper
	 */
	public String getSearchOper() {
		return searchOper;
	}

	/**
	 * @param searchOper
	 *            the searchOper to set
	 */
	public void setSearchOper(String searchOper) {
		this.searchOper = searchOper;
	}

	/**
	 * @return the searchString
	 */
	public String getSearchString() {
		return searchString;
	}

	/**
	 * @param searchString
	 *            the searchString to set
	 */
	public void setSearchString(String searchString) {
		this.searchString = searchString;
	}

	/**
	 * @return the sidx
	 */
	public String getSidx() {
		return sidx;
	}

	/**
	 * @param sidx
	 *            the sidx to set
	 */
	public void setSidx(String sidx) {
		this.sidx = sidx;
	}

	/**
	 * @return the sord
	 */
	public String getSord() {
		return sord;
	}

	/**
	 * @param sord
	 *            the sord to set
	 */
	public void setSord(String sord) {
		this.sord = sord;
	}

	/**
	 * @return the totalCount
	 */
	public int getTotalCount() {
		return totalCount;
	}

	/**
	 * @param totalCount
	 *            the totalCount to set
	 */
	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
	}

	/**
	 * @return the currentResult
	 */
	public int getCurrentResult() {
		currentResult = (page - 1) * getRows();
		if (currentResult < 0)
			currentResult = 0;
		return currentResult;
	}

	/**
	 * @param currentResult
	 *            the currentResult to set
	 */
	public void setCurrentResult(int currentResult) {
		this.currentResult = currentResult;
	}

	/**
	 * @return the totalPage
	 */
	public int getTotalPage() {
		if (totalCount % rows == 0)
			totalPage = totalCount / rows;
		else
			totalPage = totalCount / rows + 1;
		return totalPage;
	}

	/**
	 * @param totalPage
	 *            the totalPage to set
	 */
	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}

}
